package us.kg.kotoriforest.springmvc.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * 测试RequestMapping注解的位置
 *
 * @author Kotori rotroutine@163.com
 * @since 2025/1/16
 */
@Controller
// @RequestMapping("/request")
public class RequestMappingController {
    @RequestMapping(
            value = {"test1", "test2", "ttt"},
            method = {RequestMethod.GET, RequestMethod.POST},
            params = {"username", "password"}
    )
    public String test() {
        return "test";
    }

    @RequestMapping("/a?t")
    public String testAntStylePath() {
        return "test";
    }

    @RequestMapping("/testpath/{username}/{password}/*")
    public String testPath(@PathVariable("username") String username,
                           @PathVariable("password") String password) {

        System.out.println(username + " " + password);
        return "test";
    }
}
